export enum APIProvider {
  OpenAI = 'OpenAI',
  Ollama = 'Ollama',
  Gemini = 'Gemini',
}

export enum storageKeys {
  Chats = 'chats',
  Assistants = 'assistants',
  Settings = 'settings',
  ChatIId = 'currentChatId',
  AssistantId = 'currentAssistantId',
}

export enum DataStorePlatform {
  Gist = 'GithubGist',
  JsonStorage = 'JsonStorage',
}

export interface Assistant {
  id: string
  name: string
  modelApi: string
  modelName: string
  apiKey: string
  apiHost: string
  prompt: string
  mark: string
}

export interface ChatOptions {
  store: boolean
  reasoning_effort: string // low,medium,high
  frequency_penalty: number // -2.0 ~ 2.0
  logit_bias?: Map<string, number> // 这个暂时先不支持
  logprobs: boolean
  top_logprobs: number | null // 暂时不支持
  max_tokens_limit: boolean
  max_completion_tokens: number | null | string
  n: number
  modalities?: ['text'] // 暂时不支持
  prediction?: object // 暂时不支持
  presence_penalty: number
  seed?: null // beta 版
  service_tier?: string
  // parallel_tool_calls: false // 只有在tools指定时才起作用
  temperature: number
  top_p?: 1 // 和temperature有作用类似
}

export interface Chat {
  id: string
  name: string
  category?: string
  messages: MessageType[]
  options: ChatOptions
}

export const MessageRoleEnum = {
  System: 'system', // future developer
  User: 'user',
  Assistant: 'assistant',
} as const
export type MessageRole = (typeof MessageRoleEnum)[keyof typeof MessageRoleEnum]

export interface MessageType {
  id: string
  role: MessageRole
  content: string
  name?: string

  aiProvider?: string
  model?: string
  timestamp?: number
}

export interface Settings {
  showWordCount?: boolean
  showTokenCount?: boolean
  showTokenUsed?: boolean
  showModelName?: boolean
  showMessageTimestamp?: boolean

  theme: Theme
  language: Language

  autoGenerateTitle: boolean

}

export type Language = 'en' | 'zh-Hans'

export enum Theme {
  DarkMode,
  LightMode,
  FollowSystem,
}
